package pers.wwz.study.tencentcop.utils;

import java.util.Calendar;
import java.util.Date;

public class DateUtils {


    /**
     * 获取当前是星期几
     * @return "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"
     */
    public static String getWeekDayString() {
        String weekString = "";
        final String dayNames[] = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
        Calendar calendar = Calendar.getInstance();
        Date date = new Date();
        calendar.setTime(date);
        int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
        weekString = dayNames[dayOfWeek - 1];
        return weekString;
    }

    public static void main(String[] args) {
        String weekDayString = getWeekDayString();
        System.out.println(weekDayString);
    }

}
